/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * Auto7.1
 */

package com.register.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author Yogesh
 */
public class Step1_Controller extends org.apache.struts.action.Action {
    
    /* forward name="success" path="" */
    private static String SUCCESS;
    
    
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {


        
            com.register.Model.Step1_Model step1=(com.register.Model.Step1_Model) form;          

             request.setAttribute("step1",step1);

            if(step1.getFlag().equals("1")){

            String firstname =step1.getFirstName();
            String lastname=step1.getLastName();
            String mobileNumber=step1.getMobileNumber();
            String emailId=step1.getEmailId();
            String password=step1.getPassword();
            String activationCode=step1.getActivationCode();


          



//             SendMail s=new SendMail();
//                s.send(firstname, lastname, activationCode,emailId);


            new SppedyDataStore(step1);
            new SpeedyEmaiSendl(firstname+" "+lastname+" "+activationCode+" "+emailId+" "+mobileNumber+" "+step1.getIpAddress());
            new MakeDirectory(activationCode);
            //new SaveProfilePic(activationCode);
            request.setAttribute("activationCode",activationCode);
            request.setAttribute("emailId",emailId);

                SUCCESS="Step1";
                 return mapping.findForward(SUCCESS);
            
            }
            else{

               
                 SUCCESS="Step2";
                  return mapping.findForward(SUCCESS);

            }

            
        
           
    }
}
